Skip to content

fix: stream multipart request bodies#19

Open
2830500285 wants to merge 1 commit into
openai:mainfrom
2830500285:fix/stream-multipart-uploads
Open

fix: stream multipart request bodies#19
2830500285 wants to merge 1 commit into
openai:mainfrom
2830500285:fix/stream-multipart-uploads

Conversation

@2830500285

Copy link
Copy Markdown

Closes #18.

Summary

  • stream multipart/form-data request bodies with io.Pipe instead of buffering the full encoded payload in memory
  • close owned fileUpload readers after multipart encoding completes
  • disable SDK retries for streamed multipart bodies because the body cannot be safely replayed

Validation

  • go test ./internal/apiform ./pkg/cmd -run 'TestEncode|TestMultipartRequestBodyStreamsAndClosesUploads|TestEmbedFiles|TestEmbedFilesStdin|TestEmbedFilesUploadMetadata'
  • go test ./... -run 'TestEncode|TestMultipartRequestBodyStreamsAndClosesUploads|TestEmbedFiles|TestEmbedFilesStdin|TestEmbedFilesUploadMetadata'
  • go build ./...

@2830500285 2830500285 requested a review from a team as a code owner May 22, 2026 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multipart uploads buffer the full request body in memory

1 participant